home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / ply15dat.zip / WOOD.PI < prev    next >
Text File  |  1992-09-01  |  5KB  |  143 lines

  1. // Generic Polyray input File
  2. // Polyray input file: Alexander Enzmann
  3.  
  4. // Set up the camera
  5. viewpoint {
  6.    from <0,0,-8>
  7.    at <0,0,0>
  8.    up <0,1,0>
  9.    angle 40
  10.    resolution 256, 256
  11.    }
  12.  
  13. background <0, 0, 0>
  14. light <-10, 3, -20>
  15. light < 10, 10, -20>
  16.  
  17. define wood_scale 2
  18. define light_wood <0.6, 0.24, 0.1>
  19. define median_wood <0.3, 0.12, 0.03>
  20. define dark_wood <0.05, 0.01, 0.005>
  21. define xydist wood_scale * sqrt(x * x + y * y)
  22.  
  23. define wood_turb 0.7
  24. define wood_fn  (sawtooth(xydist + wood_turb * noise(P,1)) + 1) / 2
  25.  
  26. define wood_map
  27.    color_map(
  28.       [0.0, 0.2, light_wood, light_wood]
  29.       [0.2, 0.3, light_wood, median_wood]
  30.       [0.3, 0.4, median_wood, light_wood]
  31.       [0.4, 0.7, light_wood, light_wood]
  32.       [0.7, 0.8, light_wood, median_wood]
  33.       [0.8, 0.9, median_wood, light_wood]
  34.       [0.9, 1.0, light_wood, dark_wood],
  35.       white)
  36.  
  37. define wood_texture
  38. texture {
  39.    special surface {
  40.       color wood_map[wood_fn]
  41.       ambient 0.3
  42.       diffuse 0.8
  43.       specular white, 0.2 + 0.6 * wood_fn^4
  44.       microfacet Reitz 5 + 15 * (1 - wood_fn)
  45.       }
  46.    scale <0.3, 0.3, 0.3>
  47.    }
  48.  
  49. define two_sphere object { sphere <0, 0, 0>, 2 }
  50. define corner_sphere object { sphere <0, 0, 0>, 0.3 }
  51.  
  52. // two_sphere { rotate <-30, 30, 0> wood_texture }
  53.  
  54. define rounded_box
  55.    object {
  56. // Make the corners of the box
  57.         corner_sphere { translate <-1,-1, -1> }
  58.       + corner_sphere { translate <-1, 1, -1> }
  59.       + corner_sphere { translate <-1,-1,  1> }
  60.       + corner_sphere { translate <-1, 1,  1> }
  61.       + corner_sphere { translate < 1,-1, -1> }
  62.       + corner_sphere { translate < 1, 1, -1> }
  63.       + corner_sphere { translate < 1,-1,  1> }
  64.       + corner_sphere { translate < 1, 1,  1> }
  65. // Make the edges of the box
  66.       + object { cylinder <-1, -1, -1>, <-1, 1, -1>, 0.3 }
  67.       + object { cylinder <-1,  1, -1>, < 1, 1, -1>, 0.3 }
  68.       + object { cylinder < 1,  1, -1>, < 1,-1, -1>, 0.3 }
  69.       + object { cylinder < 1, -1, -1>, <-1,-1, -1>, 0.3 }
  70.  
  71.       + object { cylinder <-1, -1,  1>, <-1, 1,  1>, 0.3 }
  72.       + object { cylinder <-1,  1,  1>, < 1, 1,  1>, 0.3 }
  73.       + object { cylinder < 1,  1,  1>, < 1,-1,  1>, 0.3 }
  74.       + object { cylinder < 1, -1,  1>, <-1,-1,  1>, 0.3 }
  75.  
  76.       + object { cylinder <-1, -1, -1>, <-1,-1,  1>, 0.3 }
  77.       + object { cylinder <-1,  1, -1>, <-1, 1,  1>, 0.3 }
  78.       + object { cylinder < 1,  1, -1>, < 1, 1,  1>, 0.3 }
  79.       + object { cylinder < 1, -1, -1>, < 1,-1,  1>, 0.3 }
  80. // Make the faces of the box
  81.        + object { box <-1, -1, -1.3>, <1, 1, 1.3> }
  82.        + object { box <-1, -1.3, -1>, <1, 1.3, 1> }
  83.        + object { box <-1.3, -1, -1>, <1.3, 1, 1> }
  84.       }
  85. // rounded_box { rotate <-30, 40, 0> wood_texture }
  86.  
  87. define log_end_torus
  88. object {
  89.    torus 1, 0.3, <0, 0, 0>, <0, 0, 1>
  90.    }
  91.  
  92. define dtheta 45
  93. define theta radians(dtheta)
  94. define log_tori
  95.    object {
  96.       (  log_end_torus { translate <0, 0, 2> }
  97.        + log_end_torus { translate <0, 0, -2> } )
  98.     * (  object { polynomial y rotate <0, 0, dtheta> }
  99.        + object { polynomial y rotate <0, 0,-dtheta> } )
  100.       }
  101.  
  102. define log_body
  103.    object {
  104.         object { cylinder <0, 0, -2>, <0, 0, 2>, 1.3 }
  105.       & object { polynomial y translate <0, 1.3 * sin(theta), 0> }
  106.       }
  107.  
  108. define log_caps
  109.    object {
  110.       (  object { disc <0, 0,-2.3>, <0, 0,-1>, 1 }
  111.        + object { disc <0, 0, 2.3>, <0, 0, 1>, 1 } )
  112.       & object { polynomial y translate <0, sin(theta), 0> }
  113.       }
  114.  
  115. define log_trim
  116.    object {
  117.         object { sphere < cos(theta), sin(theta), -2>, 0.3 }
  118.       + object { sphere <-cos(theta), sin(theta), -2>, 0.3 }
  119.       + object { sphere < cos(theta), sin(theta),  2>, 0.3 }
  120.       + object { sphere <-cos(theta), sin(theta),  2>, 0.3 }
  121.       + object { cylinder <cos(theta), sin(theta), -2>,
  122.                           <cos(theta), sin(theta),  2>, 0.3 }
  123.       + object { cylinder <-cos(theta), sin(theta), -2>,
  124.                           <-cos(theta), sin(theta),  2>, 0.3 }
  125.       + object { cylinder <-cos(theta), sin(theta), -2>,
  126.                           < cos(theta), sin(theta), -2>, 0.3 }
  127.       + object { cylinder <-cos(theta), sin(theta),  2>,
  128.                           < cos(theta), sin(theta),  2>, 0.3 }
  129.       + object { polygon 4, <-cos(theta), 0.3 + sin(theta), -2>,
  130.                             <-cos(theta), 0.3 + sin(theta),  2>,
  131.                             < cos(theta), 0.3 + sin(theta),  2>,
  132.                             < cos(theta), 0.3 + sin(theta), -2> }
  133.       }
  134.  
  135. define sliced_log
  136.    object {
  137.         log_body
  138.       + log_tori
  139.       + log_caps
  140.       + log_trim
  141.       }
  142. sliced_log { rotate <-30, 20, -10> wood_texture }
  143.